<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ include file="/WEB-INF/jsp/include/taglibs.jsp"%>
<%@ page import="com.depo.quiggle.view.controller.RateTemplateAction"%>
<%@ page import="com.depo.quiggle.model.*"%>
<script type="text/javascript">
var showmasterdialog=true;

function buildMasterRateTable(result,type, userRateItemsList,buildtype, bildreq){
	 
      $("#dialog-form").html("");
	  $("#masterrate-dialog-form").html("");
	  var str = '';
	  str+='<div style="height:360px;">';
	  str += '<form>';
	  str += '<fieldset>';
	  str += '<table width="100%" border="0" cellspacing="0" cellpadding="2" id="modalratetable" class="modalratetable-pop">';
	 
	 if( buildtype != "main")
	  /*str += '<tbody>;
	  str += '<colgroup><col width="4%" />';
	  str += '<col width="9%" />';
	  str += '<col width="45%" />';
	  str += '<col width="9%" />';
	  str += '<col width="11%" />';
	  str += '<col width="11%" />';
	  str += '<col width="5%" />';
	  str += '<col width="5%" />';
	  str += '</colgroup>';*/
	  str += '<tr align="left" valign="middle">';
	  if( buildtype != "main")
	  str += '<th align="left" valign="middle" width="3%"><input type="checkbox" name="checkbox" value="checkbox" class="rtindexcheckAll-MR"/></th>';
	  str += '<th align="left" valign="middle" width="9%">Code</th>';
	  str += '<th align="left" valign="middle" width="43%">Description</th>';
	  str += '<th align="left" valign="middle" width="9%">Value</th>';
	  str += '<th align="left" valign="middle" width="11%">Unit</th>';
	  str += '<th align="left" valign="middle" width="11%">Per Unit</th>';
	  str += '<th align="center" valign="middle" width="6%">Reimbursable<BR>';
	
	  str += '<input type="checkbox" class="checkboxAllReim-MR" name="checkbox" value="checkbox" />';
	 
	  str += '</th>';
	  str += '<th align="center" valign="middle" width="7%">Taxable<BR>';
	  str += '<input type="checkbox" class="checkboxAllTax-MR" name="checkbox" value="checkbox" />';
	  str += '</th>';
	  str += '</tr>';
		


	  for(var i=0;i<result.length;i++){
			
		  str += '<tr align="left" valign="middle">';
		
		  if( buildtype != "main"){
		  str += '<td align="left" valign="middle">';
		  if($.inArray(result[i].codeName.toLowerCase(), userRateItemsList)==-1){
			  str+='<input type="checkbox" name="rateItem['+i+'].isDeleted" id="richeckBoxID"'+i+' class="rtindexcheck-MR"/>';
		 }
		  
		  str += '<input type="hidden" name="rateItem['+i+'].isDeleted" id="richeckBoxID'+i+'" class="rtindexcheck-MR"/>';
		
			
		  str += '</td>';
		  }	  
		  str += '<td align="left" valign="middle" id="rateItemCode">';
		  str += '<input type="text" readonly = "readonly"  onfocus="this.blur()" class="inputs code-name" id="'+i+'" name="rateItem['+i+'].codeName" value="'+result[i].codeName+'" />';
		  str += '</td>';
		  str += '<td align="left" valign="middle">';
		  str += '<input maxlength="499" type="text" class="inputs input-desc rateItemDescription" name="rateItem['+i+'].userRateItemDescription" value="'+result[i].userRateItemDescription+'"/>';
		  str += '</td>';
		  str += '<td align="left" valign="middle">';
		  str += '<input maxlength="11" type="text" class="inputs input-value rate-item-val" name="rateItem['+i+'].value" value="0.00"/>';
		  str += '</td>';
		  str += '<td align="left" valign="middle">';
		  str += '<select name="rateItem['+i+'].perUnit" id="perUnitId" value="'+result[i].unit+'" class="price-type-id">';
		  <c:forEach items="${actionBean.ratePriceType}" var="ratePriceList" varStatus="rowCounter">
 		  str += '<option value="${ratePriceList.id}" id="{ratePriceList.type}"';
		  if(${ratePriceList.id} == result[i].unit)
			  str += ' selected="selected" ';
		  str += '>${ratePriceList.type}</option>';
		  </c:forEach>
		  str += '</select>';
		  str += '</td>';
		  str += '<td align="left" valign="middle">';
		  str += '<select name="rateItem['+i+'].unit" value="'+result[i].perUnit+'" id="unitId" style="width:95px;"  class="rate-item-list">';
  		<c:forEach items="${actionBean.ratUnitType}" var="rateUnitsList" varStatus="rowCounter">
 		  str += '<option value="${rateUnitsList.id}" id="${rateUnitsList.type}" ';
		  if(${rateUnitsList.id} == result[i].perUnit)
			 str += ' selected="selected" ';
		  str += '>${rateUnitsList.type}</option>';
		  </c:forEach>
		  
		  str += '</select>';
			
		  str += '</td>';
		  str += '<td align="center" valign="middle">';
		  
		  str += '<input type="checkbox" name="rateItem['+i+'].reimbursable"'; 
		  
		  if(result[i].reimbursble)
		  str += 'checked="true"';
		  
		  str += 'class="checkboxReim-MR"/>';
		  
		  str += '</td>';
		  str += '<td align="center" valign="middle">';
		  str += '<input type="checkbox" name="rateItem['+i+'].taxable"';
		  
		  if(result[i].taxable)
		  str += 'checked="true"';

		  str += 'class="checkboxTax-MR"/>';
		  str += '</td>';
		  str += '</tr>';
		
								
		}
	  str += '	</tbody>';
	  str += '</table>';
	  str += '</fieldset>';
	  str += '</form>';
	  str += '</div>';
	
	
	  if( buildtype != "main"){
	   $("#dialog-form").html(str);
	   if($("#profileCategory").val() == '1'){
	 		  $('#dialog-form').dialog( "option", "title", 'Master Rate Table A/R');
	 	}else{
	 		 $('#dialog-form').dialog( "option", "title", 'Master Rate Table A/P');
	 	}
	  }
	  else
		  $("#masterrate-dialog-form").html(str);
	  $("#modalratetable .code-name").attr("disabled","disabled");
	  $(".rtindexcheckAll-MR").attr("checked",false);
	  if(showmasterdialog){
	  if( buildtype != "main")
	     $( "#dialog-form" ).dialog( "open" );
	  else if(bildreq)
		  $( "#masterrate-dialog-form" ).dialog( "open" );
	  quiggleCheckBoxtoggleSelect(".checkboxAllTax-MR", ".checkboxTax-MR");
 	  quiggleCheckBoxtoggleSelect(".checkboxAllReim-MR", ".checkboxReim-MR");
 	 quiggleCheckBoxtoggleSelect(".rtindexcheckAll-MR", ".rtindexcheck-MR");}
 	 
 	 if(buildtype == "main" && showmasterdialog){
 		 
 		 if(type == 1){
      	   $('#masterrate-dialog-form').dialog( "option", "title", 'Master Rate Table A/R');
         }else{
      	   $('#masterrate-dialog-form').dialog( "option", "title", 'Master Rate Table A/P');
         }
 	 }
 }


 var  count = 0;
 var previousSelectedtype = 0;
 var masterRateTableResult = null;
function setMasterRateItemsList(userRateItemsList){
	if(previousSelectedtype == $("#profileCategory").val() && count != 0 && masterRateTableResult !=null){
		 buildMasterRateTable(masterRateTableResult,$("#profileCategory").val(), userRateItemsList,"old");
		 return false;
	}

	previousSelectedtype = $("#profileCategory").val();
	count++;
	
	   $.ajaxSetup({
		   jsonp: null,
		   jsonpCallback: null
		});

	    $.ajax({
		  type:'POST',
		  url: 'rate-template.action?getMasterRateItemsVoList',
		  dataType: 'json',
		  data: {rateTableType: $("#profileCategory").val() },
		  success: function(result){
			  masterRateTableResult = result;
			 buildMasterRateTable(result,$("#profileCategory").val(), userRateItemsList,"old");
    
		 },
		  error:function() { 
			  
		  }
	});
}
 
 function getMasterRateTable(type,bildreq){
	   $.ajaxSetup({
		   jsonp: null,
		   jsonpCallback: null
		});

	    $.ajax({
		  type:'POST',
		  url: 'rate-template.action?getMasterRateItemsVoList',
		  dataType: 'json',
		  data: {rateTableType: type },
		  success: function(result){
			  masterRateTableResult = result;
			
			 buildMasterRateTable(result,type,new Array(),"main",bildreq);
    
		 },
		  error:function() { 
			  
		  }
	});
	 
 }
 function checkForJobStartDate(ispopup)
 {

	var count = 0;
	var numbererrorstr='<div class="ketchup-errorPar"><div class="ketchup-error" style="top:24px;"><ul><li>This field is Required .</li></ul><span></span></div></div>';
 	$(".job-start").each(function(){
 	if($(this).is(':visible')){
 		if($.trim($(this).val()).length == 0){
 			count = count+1;
 		}
 		
 	}
 		
 	});
 	
	if(count == 0)
		return true;
 	if(count >= 1){
 		
	$('.job-start').before(numbererrorstr);
 		//$("#ui-tips").text("Friday Start Date is Required").addClass( "ui-state-highlight");
		if(ispopup)
			$('.job-start').before(numbererrorstr);
		//$("#rateTableForm").animate({scrollTop: $("#ui-tips").offset().top}, "slow");
				
  		//$('html, body').animate({ scrollTop: $("#ui-tips").offset().top }, "slow");
 	}
 		
 	return count > 1 ? true : false; 
 }
 	
function checkProfileCategoryDetails(ispopup)
{
	var errorFlag = true;
	var profileCategory = $("#profileCategory").find("option:selected").text();
	var profileName = $("#profileType").find("option:selected").text();
			
	 if(profileCategory == "RECEIVABLE")
	 {
	   if(profileName != "AGENCY")
		{
		   $("#ui-tips").text("Please Select Profile Name As AGENCY.").addClass( "ui-state-highlight" );
		  if(ispopup)
		    $("#rateTableForm").animate({scrollTop: $("#ui-tips").offset().top}, "slow");
				
  		    $('html, body').animate({ scrollTop: $("#ui-tips").offset().top }, "slow");
			  errorFlag = false;
		}
	  }
	  else if(profileCategory == "PAYABLE")
	  {
		if(profileName == "AGENCY" || profileName =="REPORTER")
		{
		 $("#ui-tips").text("Please Select Profile Name As SCOPIST/PROOFREADER.").addClass( "ui-state-highlight" );
			if(ispopup)
			  $("#rateTableForm").animate({scrollTop: $("#ui-tips").offset().top}, "slow");
				
  			  $('html, body').animate({ scrollTop: $("#ui-tips").offset().top }, "slow");
			  errorFlag = false;
		 }
		}
	 else 
	  errorFlag = true;
	    return errorFlag;
	
}

</script>
	<div class="infoBut rateTableInfoBut" id="infoBut" style="z-index:999;"><a href="#" id="infoButton"><img id="helpIMG" src="images/infoicon.png"  alt="Information" border="0" /></a></div>

	<div class="infoBut qglRateTblInfoBut"  style="display:none;top:100px;position:absolute;"><a href="#" id="qglRTinfoButton"><img id="qglRTinfoIMG" src="images/infoicon.png"  alt="Information" border="0" /></a></div>	
		
<div>	
<%--@elvariable id="actionBean" type="com.depo.quiggle.view.controller.RateTemplateAction"--%>
<stripes:form action="<%=RateTemplateAction.URL%>" method="post"  id="rateTableFormId">

        <!-- DISPLAY SUCCESS MESSAGE AFTER SAVE START--> 

		<%
		if (request.getParameter("savedStatus") != null) {
		%><div class="alert alert-success" id="successDiv"><b>Your Information Saved Successfully</b><button class="close" type="button">×</button></div><%
		}
		%>
		
		 <!-- DISPLAY SUCCESS MESSAGE AFTER SAVE START--> 

		<%
		if (request.getParameter("deleted") != null) {
		%><div class="alert alert-success" id="successDiv"><b>This Profile is used in Working Jobs, You cannot remove this Profile.</b><button class="close" type="button">×</button></div><%
		}
		%>
				 
<div id="save-or-discard"></div>
		<div class="instructions" style="width: 95%;">
            <h3>
				<span class="fright instrutionsSpanForQGL" id="instrutionsSpan">
					<a href="javascript:{}" title="click here to hide the instructions" id="instructionsHideLink" class="instructionsHideLinkForQGL" style="background:#E3F2FF;">
						<img  id="instructionsDownarrowimg" src="images/uparrow.png" width="10" height="9" alt="Hide" />
					</a>
				</span>
			RATE TABLE</h3>
            	<div id="contentIns" class="contentInsDiv"><strong>Rate Tables Profiles are created for each individual Accounts Receivable and Accounts Payable</strong>
<ul>
  <li>Select A/R and A/P codes with discrete values</li>
<li>Rates applied to a job are QGL-calculated</li>
<li>Turn-in dates and pay periods are applied for each Rate Table Profile</li>
</ul>
</div>
            
</div>
<stripes:hidden name="purpose"/>
	<div class="ratestyle">
		
		<!--rateprofile leftcontent start here-->
		
		
		<c:choose>
			<c:when test='${actionBean.purpose eq "rateTable"}'>
				<div class="rateleftcontent">			
			</c:when>
			<c:otherwise>
				<div class="rateleftcontent" style="display:none;">			
			</c:otherwise>
		</c:choose>
 			<div id="ratePrfLinks" style="display:none;">
				<c:forEach items="${actionBean.rateProfilesList}" var="ratePrfLinks" varStatus="loop">
					${ratePrfLinks.rateProfileTypeId}-${ratePrfLinks.initials}-${loop.index}
					<c:if test="${!loop.last}">,</c:if>			
				</c:forEach>
			</div>
		
	
			<div class="rateprofilehead">
				<div class="rateprofile">Rate Profiles</div>
								<stripes:link href="<%=RateTemplateAction.URL%>" class="addprofile" style="color:#FFFFCC;">Add Profile</stripes:link>

 			</div>
		
			<div class="addprofiles">
				<ul> 
					<c:set var="isReceivableLableSet" value="1" scope="request" />
					<c:set var="isPayableLableSet" value="2" scope="request" />
					<c:set var="showReceiveLabel" value="true" scope="page" />
					<c:set var="showPayableLabel" value="true" scope="page" />
					 
                    	<c:forEach items="${actionBean.rateProfilesList}" var="rateProfilesLists" varStatus="rowCounter">
				 
					  
						 <c:if test="${rateProfilesLists.rateTemplateTypeId == isReceivableLableSet}" >
					 
						 <c:if test="${showReceiveLabel == true}">
					       <li>
                             <h2>ACCOUNTS RECEIVABLE</h2>
                             <a class="master-left-table" href="javascript:{}" onclick="showmasterdialog=true;getMasterRateTable(1,true)">Master Rate Table A/R</a>
                           </li>
						   </c:if>
						
						<c:set var="showReceiveLabel" value="false" scope="page" />
						
						 <li><stripes:link class="ratePrfLinkId" href="<%=RateTemplateAction.URL%>">
									<stripes:param  name="rateId" value="${rateProfilesLists.rtId}"></stripes:param>${rateProfilesLists.profileTypeName}-${rateProfilesLists.initials}  
					</stripes:link><span id="rtprf${rateProfilesLists.rtId}" style="display:none;">${rowCounter.index}</span></li>
					 
					</c:if>
					</c:forEach>

					<c:forEach items="${actionBean.rateProfilesList}" var="rateProfilesLists" varStatus="rowCounter">
					  <c:if test="${rateProfilesLists.rateTemplateTypeId == isPayableLableSet}">
					  <c:if test="${showPayableLabel == true}">
					       <li>
                             <h2>ACCOUNTS PAYABLE</h2>
                             <a class="master-left-table" href="javascript:{}" onclick="showmasterdialog=true;getMasterRateTable(2,true)">Master Rate Table A/P</a>
                           </li>
						   </c:if>
						
					<c:set var="showPayableLabel" value="false" scope="page" />
								 
						 
							<li><stripes:link class="ratePrfLinkId"  href="<%=RateTemplateAction.URL%>">
								<stripes:param name="rateId" value="${rateProfilesLists.rtId}"></stripes:param>${rateProfilesLists.profileTypeName}-${rateProfilesLists.initials}
					</stripes:link><span id="rtprf${rateProfilesLists.rtId}" style="display:none;">${rowCounter.index}</span></li>
						</c:if>
					
					</c:forEach>		
					 

				 
											

				</ul>
			</div>
		</div>
		<!--rateprofile leftcontent end here-->
		
		
		<!--rateprofile rightcontent start here-->
		<c:choose>
			<c:when test='${actionBean.purpose eq "rateTable"}'>
				<div class="profilerightcontent">
			</c:when>
			<c:otherwise>
				<div class="profilerightcontent" style="width:100%;">
			</c:otherwise>
		</c:choose>
		
		<div id="ui-tips">

		</div>
		<div id="curRTId" style="display:none;">${actionBean.rateTemplate}</div>
		<c:if test="${actionBean.rateTemplate.existence == true}">
		<div class="rateheading"> <span id="rateTblInitials"> ${actionBean.rateTemplate.entityUser.initials} </span> Rate Table</div></c:if>
		<c:if test="${actionBean.rateTemplate.existence != true && actionBean.rateTemplate.entityUser.initials == null}">
		<div class="rateheading"> <span id="rateTblInitials"> ${actionBean.rateTemplate.entityUser.initials} </span> Rate Table</div></c:if>
		<c:if test="${actionBean.rateTemplate.existence != true && actionBean.rateTemplate.entityUser.initials != null}">
		<div class="rateheading"> <span id="rateTblInitials"> ${actionBean.rateTemplate.entityUser.initials} </span> Rate Table has been archived</div></c:if>
				<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">
			<div class="mandatory">
				Fields marked <sup>*</sup> are mandatory
			</div>
			</c:if>
			<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">
			<div class="userdetailsform">
				<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="profileCategory">Profile Category*</stripes:label>
						<stripes:select name="rateTemplate.rateTemplateTypeId"
							id="profileCategory" class="select-box">
							 <stripes:options-collection collection="${actionBean.profileCategories}" label="name" value="id"/>
						</stripes:select>
						<%-- <stripes:text class="inputs" name="rateTemplate.profileCategory"/> --%>
					</div>
					<div class="userdetailsformcolum">
						<stripes:label for="profileType">Profile Name	*</stripes:label>
						<stripes:select name="rateTemplate.rateProfileTypeId" id="profileType" class="select-box">
						<stripes:options-collection collection="${actionBean.profileTypes}" label="name" value="id"/>

						</stripes:select>
					</div>
				<div class="userdetailsformcolum">
						<stripes:label for="workPhone">Web Site URL</stripes:label>
						<stripes:text maxlength="499" class="inputs urlinput" id="websiteurl" name="rateTemplate.webSiteURL"
							 />
					</div>

				</div>
				<stripes:hidden id="entityUserUserId"  name="rateTemplate.entityUser.userId"
							 />
				
				<div class="userdetailsformrow">

					<div class="userdetailsformcolum">
						<stripes:label for="initials">Initials*</stripes:label>
						<stripes:text maxlength="10" class="inputs mandatoryfield" name="rateTemplate.entityUser.initials"
							id="initials" />
					</div>

					<div class="userdetailsformcolum">
						<stripes:label for="name">Full Name*</stripes:label>
						<stripes:text maxlength="99" class="inputs mandatoryfield" name="rateTemplate.entityUser.firstName" id="fullName" />
					</div>
				

						<div class="userdetailsformcolum">
						<stripes:label for="workPhone">Work Phone</stripes:label>
						<stripes:text maxlength="19" class="inputs phoneval" name="rateTemplate.mainPhone"
							id="mainPhone" />
					</div>
					<!--  TODO: We do not have database column modeled for this field -->
					<!-- 
					<div class="userdetailsformcolum">
						<label>Website</label> <input type="text" />
					</div>
					 -->
				</div>

				<stripes:hidden id="rateItemItemId"  name="rateTemplate.rtId"  />
				
				<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="addressLine1">Address Line 1</stripes:label>
						<stripes:text maxlength="99" class="inputs" name="rateTemplate.address.address1"
							id="addressLine1" />
					</div>
					<div class="userdetailsformcolum">
						<stripes:label for="addressLine2">Address Line 2</stripes:label>
						<stripes:text maxlength="99" class="inputs" name="rateTemplate.address.address2"
							id="addressLine2" />
					</div>
					<div class="userdetailsformcolum">
						<stripes:label for="city">City</stripes:label>
						<stripes:text maxlength="49" class="inputs" name="rateTemplate.address.city"
							id="city" />
					</div>
				</div>

				<stripes:hidden  name="rateTemplate.address.addressId"  />
				<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="state">State</stripes:label>
						<!--<stripes:select name="rateTemplate.address.state"
							id="contactType[${contactLoop.index}]" class="select-box">
							<stripes:options-collection collection="${actionBean.usaStates}" label="fullName" value="shortName"/>
							
						</stripes:select>-->
						 <stripes:text maxlength="25"  class="usaStates t-tip" id="contactType[${contactLoop.index}]" name="rateTemplate.address.state" />
					</div>

					<div class="userdetailsformcolum">
						<stripes:label for="zip">ZIP</stripes:label>
						<stripes:text maxlength="14" class="inputs" name="rateTemplate.address.zip"
							id="zip" />
					</div>

					<div class="userdetailsformcolum">
						<stripes:label for="timeZone">Time Zone</stripes:label>
						<stripes:select  id="timeZone" name="rateTemplate.address.timeZone" class="select-box" >
                           <stripes:options-collection collection="${actionBean.timeZones}" label="timeZoneValue" value="timeZoneId"/>
                        </stripes:select>
					</div>
				</div>
				<!--<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="cellPhone">Cell Phone</stripes:label>
						<stripes:text class="inputs" name="rateTemplate.cellPhone"
							id="cellPhone" />
					</div>
<stripes:hidden name="rateTemplate.address.addressId" />

					<div class="userdetailsformcolum">
						<stripes:label for="fax">Fax</stripes:label>
						<stripes:text class="inputs" name="rateTemplate.fax" id="fax" />
					</div>

					<div class="userdetailsformcolum">
						<stripes:label for="email">Email</stripes:label>
						<stripes:text class="inputs" name="rateTemplate.email" id="email" />
					</div>
				</div>-->
					<!-- added -->
		<c:forEach items="${actionBean.rateTemplate.contactsList}"
						var="rateItem" varStatus="contactLoop">

<div id="contactTemplate-${contactLoop.index}" class="profile-block" style="width:98%;">

<c:set var="contactIndex" value="0" scope="page" />
		<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="contactType[${contactLoop.index}]">Contact Type</stripes:label>
						<stripes:select name="rateTemplate.contactsList[${contactLoop.index}].contactTypeId"
							id="contactType[${contactLoop.index}]" class="select-box">
							<stripes:options-collection collection="${actionBean.contactTypes}" label="name" value="id"/>
							
						</stripes:select>
					</div>


      
				
					<div class="userdetailsformcolum">
						<stripes:label for="Contact Name">Contact Name</stripes:label>
						<stripes:text maxlength="99" class="inputs" name="rateTemplate.contactsList[${contactLoop.index}].contactName"
							id="ContactName[${contactLoop.index}]" />
					</div>


					<div class="userdetailsformcolum">
						<stripes:label for="Phone"> Phone</stripes:label>
						<stripes:text maxlength="19" class="inputs phoneval" name="rateTemplate.contactsList[${contactLoop.index}].contactPhone" id="Phone[${contactLoop.index}]" />
					</div>
</div>


		<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="Email">Email</stripes:label>
						<stripes:text maxlength="49" class="inputs emailval" name="rateTemplate.contactsList[${contactLoop.index}].contactEmail" id="email[${contactLoop.index}]" />
					</div>
				</div>
<stripes:hidden  name="rateTemplate.contactsList[${contactLoop.index}].rtcId" id="rtcId[${contactLoop.index}]" />


<div class="f-l p-5">
            <div class="p-0">
                <stripes:hidden class="delete-input" name="rateTemplate.contactsList[${contactLoop.index}].deleted"/>
                <span class="delete-button p-button p-5" template="contactTemplate-${contactLoop.index}">Delete</span>
            </div>
        </div>
        <div class="clear"></div>
    </div>
<c:set var="contactIndex" value="${contactLoop.index + 1}"/>
   </c:forEach>
<div id="contactaddress-placeholder" class="hidden"></div>
<div class="profile-block" style="width:98%;">
       
    <div>
        <span id="addContactAddress" class="p-5 add-button p-button"> Add Contact</span>
    </div>

</div>





				<!-- end -->
	<c:set var="payPrdIndex" value="0" scope="page" />
	<c:forEach items="${actionBean.rateTemplate.payPeriodList}" var="payPrd" varStatus="payPrdLoop">
	    <div id="payPeriodTemplate-${payPrdLoop.index}" class="profile-block" style="width:98%;">
	        <stripes:hidden	name="rateTemplate.payPeriodList[${payPrdLoop.index}].rtppId"/>
	        <stripes:hidden name="rateTemplate.payPeriodList[${payPrdLoop.index}].userId"/>
	        
	       	<div class="userdetailsformrow">
				<div class="userdetailsformcolum">
					<stripes:label for="turnedInDateId[${payPrdLoop.index}]">Turn In Cut Off Day</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].jobTurnedInDateId"
						id="turnedInDateId[${payPrdLoop.index}]" class="paydayother payday select-box">
							 <stripes:options-collection collection="${actionBean.payPeriods}" label="name" value="id"/>
					</stripes:select>				
					
					<div style="width:250px;">
					<div class="f-l p-5 hidden">
					  <stripes:label for="jobTurnedInDayType[${payPrdLoop.index}]">Date</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].jobTurnedInDateValue"
						id="jobTurnedInDayType[${payPrdLoop.index}]" class="turnInOther select-box">
							<stripes:options-collection collection="${actionBean.days}" label="value" value="key"/>
					</stripes:select>	
					</div>
					
					<div class="f-l p-5 hidden">
						<stripes:label for="jobTurnedInDayValue[${payPrdLoop.index}]">Type</stripes:label>
						<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].jobTurnedInDateType"
							id="jobTurnedInDayValue[${payPrdLoop.index}]" class="select-box" >
					 <stripes:options-collection collection="${actionBean.jobTurnInDayValues}" label="name" value="id"/>
							 
						</stripes:select>	
					</div>
					
					<div class="job-start-date">		
			<stripes:label for="jobTurnedInDate[${payPrdLoop.index}]" style="margin-top:18px;">Friday Start Date</stripes:label>
			<input  style="width:150px;border:1px solid #ccc;padding:5px;"  class="friday-date-picker job-start"  value="${payPrd.jobStartDate}" name="rateTemplate.payPeriodList[${payPrdLoop.index}].jobTurnedInDate" readonly = "readonly" id="fr-0"/>
		</div>
					</div>
				</div>
	
				<div class="userdetailsformcolum">
					<stripes:label for="payDateId[${payPrdLoop.index}]">Pay Day</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].payDateId"
						id="payDateId[${payPrdLoop.index}]" class="paydayother select-box">
						 <stripes:options-collection collection="${actionBean.payPeriods}" label="name" value="id"/>
					</stripes:select>
					
				<div style="width:250px;">
					
					<div class="f-l p-5 hidden">
					<stripes:label for="payDayType[${payPrdLoop.index}]">Date</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].payDateValue"
						id="payDayType[${payPrdLoop.index}]" class="select-box">
           <stripes:options-collection collection="${actionBean.days}" label="value" value="key"/>

					</stripes:select>					
				</div>
				<div class="f-l p-5 hidden">
					<stripes:label for="payDayValue[${payPrdLoop.index}]">Type</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].payDateType"
						id="payDayValue[${payPrdLoop.index}]" class="select-box">
						<stripes:options-collection collection="${actionBean.jobTurnInDayValues}" label="name" value="id"/>
						
					</stripes:select>
					
				</div>				
				
		</div>
		
		</div>
				
				
			</div> 
          <div class="f-l p-5">
            <div class="p-0">
			<stripes:hidden name="rateTemplate.payPeriodList[${payPrdLoop.index}].rtppId"/>
			<stripes:hidden name="rateTemplate.payPeriodList[${payPrdLoop.index}].rtId"/>
                <stripes:hidden class="delete-input" name="rateTemplate.payPeriodList[${payPrdLoop.index}].deleted"/>
                <span class="delete-button p-button p-5" template="payPeriodTemplate-${payPrdLoop.index}">Delete</span>
            </div>
        </div>
        <div class="clear"></div>
    </div>
    <c:set var="payPrdIndex" value="${payPrdLoop.index + 1}"/>
	</c:forEach>

	<div id="payPeriod-placeholder" class="hidden clear"></div>
	
	<div class="profile-block" style="width:98%;">
	    <div class="clear">
	        <span id="addPayPrd" class="p-5 add-button p-button">Add Pay Period</span>
	    </div>
	</div>
	
	
</div> </c:if><!-- userdetailsform end   -->


				<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">
				<div class="rateitembuttons">
				
  				<c:if test='${actionBean.purpose eq "rateTable"}'>
				<stripes:submit name="save" value="Save" class="button" id="save"/>
				</c:if>
				<c:if test='${actionBean.purpose eq "QGL"}'>
				<div class="f-l p-5"><input type="button" value=" Save" onClick="saveRateTableFromQGL()" class="button" /><div class="button-end"></div></div>
				<div class="f-l p-5"><input type="button" value="Apply Rate Code To Job" onClick="saveAndMapRateTableFromQGL()" class="button applybutton" /><div class="button-end"></div></div>
				 
				</c:if>
				
				<div class="f-r p-5">
				<c:if test='${actionBean.purpose eq "rateTable"}'>
				<!--<input type="submit" value="Remove Profile"	class="button" name="removeRateTable"/>-->
				</c:if>
				</div>
					
					<!-- 
					<input type="submit" value="Copy Profile" class="button" title="Search" />--> 
					
					 
				</div></c:if>
			<br style="clear: both" /> <br />
			
			<div class="rateitemform" tabindex=0>
			<div id="rate-item-success-div">

				</div>
				<div id="rateItemsuccessDiv"></div>
				<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">
				<div class="rateitemhead">Rate</div> 
				</c:if> 
<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">				
				<div class="rateactions" style="margin:0px;">
					<!--<a id="idAddRateItem" href="javascript:{}" class="p-button p-5">Add Item</a>-->
										
					<div class="f-l p-5">
					<div class="p-0">
						<a id="idAddRateItem" href="javascript:{}" class="p-button p-5">Add Item</a>
					 </div>
			      </div>

				<div class="f-l p-5">
					<div class="p-0">
						<a id="masterratetable" href="javascript:{}" class="p-button p-5" >Master Rate Table</a>
					 </div>
			      </div> 
				<div class="f-l p-5">
					<div class="p-0">
						<stripes:hidden class="riCheckBox-delete-input" name="rateTemplate[${riLoop.index}].deleted"/>
					 <span class="riCheckBox-delete-span p-button p-5"		  template="rateTemplate-${index}" id="riCheckBox-delete-spanId">Delete</span>
					 </div>
			 </div>
		</div>
			</c:if>		


				
				<div id="rate-item-err-div">

				</div>
				<div id="rate-item-qgl-err-div">

				</div>
				
				<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">
				<div class="rateitem">
					<table width="100%" border="0" cellspacing="2" cellpadding="" id="rateItemTable" class="userRateItems">
						<colgroup>
							<col width="1%" />
							<col width="10%" />
							<col width="35%" />
							<col width="10%" />
							<col width="11%" />
							<col width="11%" />
							<col width="5%" />
							<col width="5%" />
						</colgroup>
						<tr align="left" valign="middle">
							<th align="left" valign="middle"><input type="checkbox"
								name="checkbox" value="checkbox" class="rtindexcheckAll"/></th>
							<th align="left" valign="middle">Code</th>
							<th align="left" valign="middle">Description</th>
									<th align="left" valign="middle">Value</th>
							<th align="left" valign="middle">Unit</th>
							<th align="left" valign="middle">Per Unit</th>
							<th align="center" valign="middle">Reimbursable
							<input type="checkbox" name="checkbox" value="checkbox"  class="checkboxAllReim"/>
							</th>
							<th align="center" valign="middle">Taxable
							<input type="checkbox" name="checkbox" value="checkbox"  class="checkboxAllTax"/>
							</th>
						</tr>
						
					<c:set var="riIndex" value="0"/>	
				<c:if test="${actionBean.rateTemplate.rateItemList[0].codeName != null}">					
					<c:forEach items="${actionBean.rateTemplate.rateItemList}"
						var="rateItem" varStatus="riLoop">
						
    			
    						
    						<!--<div id="rateItem-${riLoop.index}"> -->
        						
							<stripes:hidden name="rateTemplate.rateItemList[${riLoop.index}].deleted" class="rateItemDeleteHidden" id="rateItem${riLoop.index}"/>
							<stripes:hidden name="rateTemplate.rateItemList[${riLoop.index}].rateItemId" class="rateItemIdHidden" id="rateItemId${riLoop.index}"/>	

							<tr align="left" valign="middle" class="table-row">
								
								<td align="left" valign="middle" id="">
								<stripes:checkbox  name="rateTemplate.rateItemList[${riLoop.index}].jobRateItem"  id="${riLoop.index}" class="rtindexcheck"/>
									
								</td>
								<td align="left" valign="middle" id="rateItemCode">
									
									<stripes:text maxlength="49" class="inputs code-name" id="${riLoop.index}" name="rateTemplate.rateItemList[${riLoop.index}].codeName" />
								</td>
								<td align="left" valign="middle">
									<stripes:text maxlength="499" class="inputs rateItemDescription" name="rateTemplate.rateItemList[${riLoop.index}].rateItemDescription" />
								</td>
								<td align="left" valign="middle">
								    <stripes:hidden   name="rateTemplate.rateItemList[${riLoop.index}].rateItemValue" value="${rateItem.rtVal}"/>
									<stripes:text maxlength="11" class="inputs rate-item-val numberVal" title="rate Value" name="rateTemplate.rateItemList[${riLoop.index}].rtVal" id="rt-item-val-${riLoop.index}"/>
								</td>
								<td align="left" valign="middle">
									
									<stripes:select name="rateTemplate.rateItemList[${riLoop.index}].priceType"	 id="unitId-${riLoop.index}" class="price-type-id">
							 <stripes:options-collection collection="${actionBean.ratePriceType}" label="type" value="id"/>
						     </stripes:select>
								</td>
								<td align="left" valign="middle">
		
							
							
					   <c:if test="${rateItem.priceType != rateItem.percUnitType}">
						<stripes:select name="rateTemplate.rateItemList[${riLoop.index}].unitType" id="perUnit-id-${riLoop.index}"  class="rate-item-list" style="width: 95px;">
						 	 <stripes:options-collection collection="${actionBean.ratUnitType}" label="type" value="id"/>
						 </stripes:select>	
					  </c:if>
						 <c:if test="${rateItem.priceType == rateItem.percUnitType}">
						 <stripes:select name="rateTemplate.rateItemList[${riLoop.index}].unitType" id="expodite-id-${riLoop.index}" class="rate-item-list" style="width:95px;">					
		                     <stripes:options-map map="${actionBean.selectedRateItemsMap}"/>
		                 </stripes:select>
						
		              </c:if>			
								</td>
								<td align="center" valign="middle">
									<stripes:checkbox name="rateTemplate.rateItemList[${riLoop.index}].reimbursable" checked="true" class="checkboxReim"/>
								</td>
								<td align="center" valign="middle">
								<stripes:checkbox name="rateTemplate.rateItemList[${riLoop.index}].taxable"  class="checkboxTax"/>
								<stripes:hidden   name="rateTemplate.rateItemList[${riLoop.index}].rateItemId" />
							<stripes:hidden   class="delete-input" name="rateTemplate.rateItemList[${riLoop.index}].deleted"  />
								</td>
							</tr>
							<!--</div>-->
							<c:set var="riIndex" value="${riLoop.index + 1}"/>
					</c:forEach>
					
					</c:if>
							</table>
						
					</div>	</c:if>
					
										
       
					
					<div id="rate-item-placeholder" class="hidden"></div>
						<div id="ri-index" class="hidden">${riIndex}</div>
						<div style="display:none;">
    					<table id="rateItemTemplate" class="profile-block template" style="width:98%;">
        						
								<tr align="left" valign="middle">
								<td align="left" valign="middle">
									<stripes:hidden   class="rateItemDeleteHidden" name="rateTemplate.rateItemList[{index}].deleted"  />
									<stripes:checkbox name="rateTemplate.rateItemList[{index}].jobRateItem" id="richeckBoxID[{index}]" class="rtindexcheck-temp"/>
									
								</td>
								<td align="left" valign="middle" id="rateItemCode">
									<stripes:text maxlength="49" class="inputs code-name" id="{index}" name="rateTemplate.rateItemList[{index}].codeName" />
									
								</td>
								<td align="left" valign="middle">
									<stripes:text maxlength="499" class="inputs rateItemDescription" name="rateTemplate.rateItemList[{index}].rateItemDescription" />
								</td>
								<td align="left" valign="middle">
									<stripes:text maxlength="11" class="inputs numberVal rate-item-val" name="rateTemplate.rateItemList[{index}].rateItemValue" />
								</td>
								<td align="left" valign="middle">
									<!--<stripes:text class="inputs" name="rateTemplate.rateItemList[{index}].priceType" />-->
									<stripes:select name="rateTemplate.rateItemList[{index}].priceType"	 id="unitId-{index}" class="price-type-id">
							 <stripes:options-collection collection="${actionBean.ratePriceType}" label="type" value="id"/>
						     </stripes:select>
								</td>
								<td align="left" valign="middle">
									<!--<stripes:text class="inputs" name="rateTemplate.rateItemList[{index}].unitType" />-->
									<stripes:select name="rateTemplate.rateItemList[{index}].unitType"
							id="perUnit-id-{index}" class="rate-item-list" style="width:95px;">
							 <stripes:options-collection collection="${actionBean.ratUnitType}" label="type" value="id"/>
						</stripes:select>
						
						 <stripes:select name="rateTemplate" id="expodite-id-{index}" class="expedite-rate-item-list" style="display:none;">					
		                   <stripes:options-map map="${actionBean.selectedRateItemsMap}"/>
		                 </stripes:select>
									
								</td>
								<td align="center" valign="middle">
									<stripes:checkbox name="rateTemplate.rateItemList[{index}].reimbursable" checked="true" class="checkboxReim-temp"/>
								</td>
								<td align="center" valign="middle">
									<stripes:checkbox name="rateTemplate.rateItemList[{index}].taxable" class="checkboxTax-temp"/>
									<stripes:hidden   name="rateTemplate.rateItemList[{index}].rateItemId" />
								</td>
							</tr>
						</table>	
						
						</div>										
						

         <div id="rate-item-qgl-err-div-bottom" style="margin-top:215px;"></div>				
		 </div>
					
					<c:set var="ratePurpose" value="${actionBean.purpose}"/>
<c:if test="${actionBean.rateTemplate.existence == true || actionBean.rateTemplate.entityUser.initials == null}">					
 				<div class="rateitembuttons">
				
  				<c:if test='${actionBean.purpose eq "rateTable"}'>
				<stripes:submit name="save" value="Save" class="button" />
				</c:if>
				<c:if test='${actionBean.purpose eq "QGL"}'>
					<div class="f-l p-5"><input type="button" value=" Save" onClick="saveRateTableFromQGL()" class="button" /><div class="button-end"></div></div>
					<div class="f-l p-5" style="display:none;"><input id="applybutton" type="button" value="Apply Rate Code To Job" onClick="saveAndMapRateTableFromQGL()" class="button applybutton" /><div class="button-end"></div></div>
				 
				</c:if>
				
				<div class="f-r p-5">
				<c:if test='${actionBean.purpose eq "rateTable"}'>
				<input  value="Remove Profile" style="padding: 0 0 0 21px;width: 95px;"	class="button deleteRateProfile"/>
				</c:if>
				</div>
					
					<!-- 
					<input type="submit" value="Copy Profile" class="button" title="Search" />--> 
					
					 
				</div></c:if>
				
				
			</div>
		</div>
		<!--rateprofile rightcontent end here-->
	</div>


<!-- added templates -->



<div id="contactTemplate" class="profile-block template" style="width:98%;">
<div class="userdetailsformrow">
<div class="userdetailsformcolum">
						<stripes:label for="contactType[${contactLoop.index}]">Contact Type</stripes:label>
						 <stripes:select name="rateTemplate.contactsList[{index}].contactTypeId"
							id="contactType{index}">
						 
							 <stripes:options-collection collection="${actionBean.contactTypes}" label="name" value="id"/>
						</stripes:select> 
					</div>


      
				
					<div class="userdetailsformcolum">
						<stripes:label for="Contact Name">Contact Name</stripes:label>
						<stripes:text maxlength="99" class="inputs" name="rateTemplate.contactsList[{index}].contactName"
							id="ContactName{index}" />
					</div>


					<div class="userdetailsformcolum">
						<stripes:label for="Phone"> Phone</stripes:label>
						<stripes:text maxlength="19" class="inputs phoneval" name="rateTemplate.contactsList[{index}].contactPhone" id="Phone{index}" />
					</div>
</div>

<stripes:hidden  name="rateTemplate.contactsList[{index}].rtcId" id="rtcId{index}" />
		<div class="userdetailsformrow">
					<div class="userdetailsformcolum">
						<stripes:label for="Email">Email</stripes:label>
						<stripes:text maxlength="49" class="inputs emailval" name="rateTemplate.contactsList[{index}].contactEmail" id="email{index}" />
					</div>
				</div>

	<div class="f-l p-5">
            <div class="p-0">
                <stripes:hidden class="delete-input" name="rateTemplate.contactsList[{index}].deleted"/>
                <span class="delete-button p-button p-5" template="contactTemplate-{index}">Delete</span>
            </div>
        </div>
         <div class="clear"></div>
</div>
<div id="contactaddressIndex" class="template clear">${contactIndex}</div>



<div id="payPeriodTemplate" class="profile-block template" style="width:98%;">
    <stripes:hidden	name="rateTemplate.payPeriodList[{index}].rtppId"/>
    <stripes:hidden name="rateTemplate.payPeriodList[{index}].userId"/>
	 	<div class="userdetailsformrow">
				<div class="userdetailsformcolum">
					<stripes:label for="turnedInDateId[{index}]">Turn In Cut Off Day</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[{index}].jobTurnedInDateId"
						id="turnedInDateId[{index}]" class="paydayother payday">
						 <stripes:options-collection collection="${actionBean.payPeriods}" label="name" value="id"/>
					</stripes:select>
					
					
					<div style="width:250px;">
					<div class="f-l p-5 hidden">
					<stripes:label for="jobTurnedInDayType[{index}]">Date</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[{index}].jobTurnedInDateValue"
						id="jobTurnedInDayType[{index}]" class="turnInOther">
				 <stripes:options-collection collection="${actionBean.days}" label="value" value="key"/>

						
					</stripes:select>				
				</div>
					
					<div class="f-l p-5 hidden">
					<stripes:label for="jobTurnedInDayValue[{index}]">Type</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[{index}].jobTurnedInDateType"
						id="jobTurnedInDayValue[{index}]" >
        <stripes:options-collection collection="${actionBean.jobTurnInDayValues}" label="name" value="id"/>

					</stripes:select>					
				</div>
				
		<div class="job-start-date">		
			<stripes:label for="payDateId[{index}]" style="margin-top:18px;">Friday Start Date</stripes:label>
			<stripes:text  class="friday-date-picker job-start" style="width:150px;" id="fr-{index}" name="rateTemplate.payPeriodList[{index}].jobTurnedInDate" />
		</div>
				
				</div>
				
				</div>
	
				<div class="userdetailsformcolum">
					<stripes:label for="payDateId[{index}]">Pay Day</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[{index}].payDateId"
						id="payDateId[{index}]" class="paydayother">
							 <stripes:options-collection collection="${actionBean.payPeriods}" label="name" value="id"/>
					</stripes:select>
					<stripes:text style="margin-top:2px;display:none;" name="rateTemplate.payPeriodList[{index}].payDate" id="payDate[{index}]" />
				
				<div style="width:250px;">
				<div class="f-l p-5 hidden">
					<stripes:label for="payDayType[{index}]">Date</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[{index}].payDateValue"
						id="payDayType[{index}]">
                <stripes:options-collection collection="${actionBean.days}" label="value" value="key"/>

					</stripes:select>					
				</div>
				
				<div class="f-l p-5 hidden">
					<stripes:label for="payDayValue[{index}]">Type</stripes:label>
					<stripes:select name="rateTemplate.payPeriodList[${payPrdLoop.index}].payDateType"
						id="payDayValue[{index}]">
				<stripes:options-collection collection="${actionBean.jobTurnInDayValues}" label="name" value="id"/>

					</stripes:select>					
				</div>
				</div>
				</div>
				
			</div> 
          <div class="f-l p-5">
            <div class="p-0">
			<stripes:hidden name="rateTemplate.payPeriodList[{index}].rtppId"/>
                <stripes:hidden class="delete-input" name="rateTemplate.payPeriodList[{index}].deleted" value="false"/>
                <span class="delete-button p-button p-5" template="payPeriodTemplate-{index}">Delete</span>
            </div>
        </div>
      <div class="clear"></div>
</div>
<div id="payPrdIndex" class="template clear">${payPrdIndex}</div>
<div style="display:none;">
<div id="masterrate-dialog-form"></div>
</div>
<div style="display:none;">
<div id="dialog-form"> 
					<form>
<fmt:setBundle basename="help" var="help" />

	<fieldset>
		<table width="100%" border="0" cellspacing="2" cellpadding="3" id="modalratetable">
			<tbody><colgroup>
							<col width="1%" />
							<col width="10%" />
							<col width="32%" />
							<col width="10%" />
							<col width="11%" />
							<col width="11%" />
							<col width="5%" />
							<col width="5%" />
						</colgroup>
						<tr align="left" valign="middle">
							<th align="left" valign="middle"><input type="checkbox"
								name="checkbox" value="checkbox" class="rtindexcheckAll-MR"/></th>
							<th align="left" valign="middle">Code</th>
							<th align="left" valign="middle">Description</th>
									<th align="left" valign="middle">Value</th>
							<th align="left" valign="middle">Unit</th>
							<th align="left" valign="middle">Per Unit</th>
							<th align="center" valign="middle">Reimbursable<BR>
							<input type="checkbox" class="checkboxAllReim-MR" name="checkbox" value="checkbox" />
							</th>
							<th align="center" valign="middle">Taxable<BR>
							<input type="checkbox" class="checkboxAllTax-MR" name="checkbox" value="checkbox" />
							</th>
						</tr>
						
				
				<c:forEach items="${actionBean.userRateItemsVoList}"
						var="rateItem" varStatus="riLoop">
						
							
				<tr align="left" valign="middle">
				
			
								<td align="left" valign="middle">
									<stripes:checkbox name="rateItem[${riLoop.index}].jobRateItem" id="richeckBoxID${riLoop.index}" class="rtindexcheck-MR"/>
                                    <stripes:hidden name="rateItem[${riLoop.index}].isDeleted" id="richeckBoxID${riLoop.index}" class="rtindexcheck-MR"/>
									
									
								</td>
								<td align="left" valign="middle" id="rateItemCode">
									<stripes:text maxlength="49" class="inputs code-name" id="${riLoop.index}" name="rateItem[${riLoop.index}].codeName" value="${rateItem.codeName}" />
								</td>
								<td align="left" valign="middle">
									<stripes:text id="des" maxlength="499" class="inputs" name="rateItem[${riLoop.index}].userRateItemDescription" value="${rateItem.userRateItemDescription}"/>
								</td>
								<td align="left" valign="middle">
									<stripes:text id="priceVal" maxlength="11" class="inputs" name="rateItem[${riLoop.index}].value" value="0"/>
								</td>
								<td align="left" valign="middle">
								<stripes:select name="rateItem[${riLoop.index}].perUnit"
							id="perUnitId" value="${rateItem.perUnit}">
							 <stripes:options-collection collection="${actionBean.ratUnitType}" label="type" value="id"/>
						     </stripes:select>
								</td>
								<td align="left" valign="middle">
									<stripes:select name="rateItem[${riLoop.index}].unit" value="${rateItem.unit}"
							id="unitId">
							 <stripes:options-collection collection="${actionBean.ratePriceType}" label="type" value="id"/>
						</stripes:select>
									
								</td>
								<td align="center" valign="middle">
									<stripes:checkbox name="rateItem[${riLoop.index}].reimbursable" checked="true" class="checkboxReim-MR"/>
								</td>
								<td align="center" valign="middle">
									<stripes:checkbox name="rateItem[${riLoop.index}].taxable"  class="checkboxTax-MR"/>
								</td>
							</tr>
							
								
				</c:forEach>
			</tbody>
		</table>
	</fieldset>
	</form>
</div>
</div>
</stripes:form>


		<c:choose>
			<c:when test='${actionBean.purpose eq "rateTable"}'>
<!-- Begin InformationText -->
<div style="overflow:hidden;top:100px;height:80%;display:none;" id="infoContainer">
  <div id="infoContent" class="infoContentContainer rateTableInfoContentContainer" style="width:300px;padding-bottom: 55px;">
    <div style="text-align:right;padding:0px;margin:0px;margin-top:-5px;"><img src="images/delete-icon.gif" width="16" height="16" alt="Close" id="infoclose" style="cursor:pointer;"/></div>
    	<div class="insContent" style="height:450px;">
  <p>You can either create the new rate profile for A/R or A/P in  your first use of QGL or you may add profile starting with the Rate Table.</p>
  <ol>
    <li>Choose <strong>Profile  Category</strong></li>
        <ol>
          <li>receivable  (your client whom you bill) </li>
          <li>payable  (your subcontractor whom you pay)</li>
        </ol>
    <li>Choose <strong>Profile  Name</strong></li>
    <li>Enter <strong>Web  Site URL</strong>, if applicable (you can cut/paste from the website)</li>
    <li><strong>Initials</strong> – enter identifiable initials or shortened name (will be shown on QGL) – no duplication allowed</li>
    <li><strong>Full  Name – </strong>Enter full name (will be shown on invoices)</li>
    <li><strong>Work  Phone – </strong>Enter main phone number</li>
    <li><strong>Address  Line 1- </strong>Enter number and street name</li>
    <li><strong>Address  Line 2</strong> – Enter Unit, Suite or Apartment number (if applicable)</li>
    <li><strong>City,  State, ZIP  – </strong>Enter (will be shown on  invoices)</li>
    <li><strong>Time  Zone – </strong>Choose the Time Zone for this address (if known)</li>
    <li><strong>Contact  Type – </strong>Choose contact type (<strong>owner</strong> for A/P)</li>
    <li><strong>Contact  Name, phone and email</strong></li>
    <li><strong>Add  Contact –</strong> Enter as many contacts as you would like related to accounts  receivable</li>
    <li><strong>Job  Turn In Day- </strong>Enter the cutoff date</li>
    <li><strong>Pay  Day</strong>- Enter the pay day (related to the above Job Turn In Day)</li>
    <li><strong>Add  Pay Period </strong>(for more than one pay period monthly, repeat steps 14 and 15</li>
    <li><strong>Save</strong></li>
    <li><strong>Master  Rate Table – </strong>QGL-created codes for your convenience and ease of use (and  future integration) – feel free to change the descriptions, <strong>add </strong>new codes.  Values  are not saved in the <strong>MASTER rate table</strong>;  however, they are saved for the individual rate tables.  Refer to the <strong>Per Unit definitions. </strong></li>
    <li><strong>Code</strong> reasoning (similar to description)  Originals start with the letter &ldquo;O&rdquo;; certified copies start with the letter  &ldquo;C&rdquo;; expedites start with the letter &ldquo;X&rdquo;; and items that are non-reimbursable  most often have a hyphen N &ldquo;-N&rdquo; following the code.  </li>
    <ol>
      <li>TIP:  When creating new codes, choose Per Unit <strong>ACTUAL</strong> for all items that will be type  (based on pages, hour, word, event or single-service item) as this figure will  be multiplied by the <strong>Value</strong> for the  QGL calculation and generation of invoices.</li>
      <li>TIP:  <strong>Unit </strong>is  US Dollars or percent which is a percent of the <strong>CODE</strong> that you choose that is   often used with expedites (i.e., 3-day Expedite =80% of the <strong>code</strong> O1M, Original +1 Medical)</li>
    </ol>
    <li><strong>Description </strong>– related to the code and as shown on the invoice</li>
    <li><strong>Value</strong> – Enter the value based on the amount   (the amounts WILL BE saved in the Rate Table Profile for each separate  A/R or A/P)</li>
    <ol>
      <li>billed  and to be received (A/R)  </li>
      <li>paid  out to subcontractors (A/P)</li>
    </ol>
    <li><strong>Unit  – </strong>US Dollars or percent (percents will apply to rate codes applied to the  particular job)</li>
    <ol>
      <li>TIP:  Additional expedite codes can be created for  certified copies</li>
    </ol>
    <li><strong>Reimbursable</strong> – check this box if you bill the A/R for this code service/expense</li>
    <ol>
      <li>Uncheck  reimbursable if you will NOT bill and will NOT be paid for a service/expense</li>
    </ol>
    <li><strong>Taxable</strong> – check this box if the item is taxable</li>
    <li><strong>Per  Unit:        </strong></li>
    <ol>
      <li><strong>ACTUAL</strong> - This is calculated based on  the <strong>TYPE</strong> and on the actual pages  entered in <strong>ACTUAL</strong> PAGES.  This would apply to the Original, Original +  certified copies, and Single-service billing.   NOTE:  Only one <strong>Type</strong> can be chosen; all other  services/expenses are captured under another field.</li>
      <li><strong>HOUR – </strong>This is calculated based on per-hour  amount</li>
      <li><strong>PAGE- </strong>This is calculated based on  per-page amount</li>
      <li><strong>EVENT</strong> –This is calculated on a one-time  event amount</li>
      <li><strong>PER DIEM – </strong>This is calculated on a  per-diem amount</li>
      <li><strong>COST – </strong>This is the actual cost/receipt  for expense</li>
      <li><strong>CODE – </strong>This is <strong>QGL-calculated</strong> based on  TYPE or other service/expense chosen for the job</li>
    </ol>
    <li><strong>Add  Selected Items to Rate Table – </strong>choose the codes you would like to move to  the Rate Table Profile</li>
  </ol>
  <p>NOTE:   Values may be entered at any time in the  Rate Table Profile and will be saved.  To  apply a code to a particular job, it must be done through QGL and is job  specific.   Items can only be deleted  from a Rate Table Profile if they have not been used for the specific Rate  Table Profile.<br />
  <br> TIP:  Adding a new code to the Rate Table Profile  will also save it in the MASTER RATE TABLE so you can add the same code to  multiple Rate Table Profiles and enter a value specific for that A/R or A/P.</p>
</div>
    
  </div>
  <div style="float:right;color:#FFF;" class="slidebuttonDiv rateTableSlidebuttonDiv"><a href="#" id="slidebutton1"><img src="images/infoicon.png"  alt="Information" border="0" /></a></div>
  
</div>
 <!-- End InformationText --> 
 			</c:when>
			<c:otherwise>
				<!-- Begin InformationText -->
<div style="overflow:hidden;top:100px;position:absolute;right:0;display:none;" id="qglRTinfoContainer">
  <div id="infoContent" class="infoContentContainer qglRateTblInfoContentContainer" style="width:300px;display:none;">
    <div style="text-align:right;padding:0px;margin:0px;margin-top:-5px;"><img src="images/delete-icon.gif" width="16" height="16" alt="Close" id="qglRTinfoclose" style="cursor:pointer;"/></div>
    	<div class="insContent" style="top:100px;height: 250px;">
  <strong>EACH ACCOUNTS  RECEIVABLE AND ACCOUNTS PAYABLE HAS ITS OWN RATE TABLE</strong>
<p><strong>AGENCY</strong>  - hyperlink takes you to the Rate Table.  Clicking on Master Rate Table will open up 
  QGL- created <strong>MASTER RATE TABLE A/R </strong>codes.  Please choose by clicking the Code  box.</p>
  You may enter the VALUE here and it saves in the Rate  Table <strong>OR</strong> you may choose the code now  and enter the VALUE on the Rate Table later.   APPLY RATE CODE</p>
 <p> <strong>SCOPIST</strong>  - hyperlink takes you to the Rate Table.  Clicking on Master Rate Table will open up 
  QGL- created <strong>MASTER RATE TABL A/P </strong>codes.  Please choose by clicking the Code  box.  </p>
  You may enter the VALUE here and it saves in the Rate  Table <strong>OR</strong> you may choose the code now  and enter the VALUE on the Rate Table later.</p>
 <p> <strong>PROOFER</strong> - hyperlink takes you to the Rate Table.   Clicking on Master Rate Table will open up
  QGL- created <strong>MASTER RATE TABLE A/P </strong> codes.  Please choose by clicking the  Code box.  </p>
  You may enter the VALUE here and it saves in the Rate  Table <strong>OR</strong> you may choose the code now  and enter the VALUE on the Rate Table later.</p>
</div>
    
  </div>
  <div style="float:right;color:#FFF;display:none;" class="slidebuttonDiv qglRateTblSlidebuttonDiv"><img id="qglRTslidebutton1" src="images/infoicon.png"  alt="Information" border="0" style="cursor:pointer;"/></div>
  
</div>
 <!-- End InformationText --> 		
			</c:otherwise>
		</c:choose>


<style>
.dashboard-content{display:table;}
.hidden{display:none;}

input[type="text"]{border-radius:5px;}
.rateitem input[type="checkbox"]{float:none;}
.userdetailsformcolum select:focus, .rateitem select:focus{background:#FFF9B8;}
.profilerightcontent .ui-state-highlight{
    margin: 5px 0 15px;
    padding: 5px 10px;
	background:#FFE4DD;
	border:1px solid #FFE4DD;
	color:#571D0E;
}
.addprofiles h2:nth-child(1){margin:12px 0px 0px 0px;}
.add-button:focus,.add-button:hover,.delete-button:focus,.delete-button:hover,.p-button:focus,.p-button:hover, 

.ui-dialog .ui-dialog-buttonpane button:focus {
background: #b3dced; /* Old browsers */
background: -moz-linear-gradient(top,  #b3dced 0%, #29b8e5 50%, #bce0ee 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b3dced), color-stop(50%,#29b8e5), color-stop(100%,#bce0ee)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* IE10+ */
background: linear-gradient(to bottom,  #b3dced 0%,#29b8e5 50%,#bce0ee 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b3dced', endColorstr='#bce0ee',GradientType=0 ); /* IE6-9 */

color:#000;

}
.errorHighlight{
	background:peachpuff;
}
.heighlight{

background:yellow;
}
.job-start-date .ketchup-errorPar .ketchup-error{position:absolute;left: 75px;
    top: -3px;
    width: 100px;}
.ketchup-errorPar{position:relative;}
.ketchup-errorPar .ketchup-error{position:absolute;left: 75px;
    top: -45px;
    width: 100px;}


td .ketchup-errorPar .ketchup-error{position:absolute;left: 20px;
    top: -25px;
    font-size:10px !important; width:135px;}
	td .ketchup-errorPar .ketchup-error ul{padding:2px 5px;}
#modalratetable .code-name,#modalratetable .code-name:focus,#modalratetable .code-name:hover{background:#ddd;color:black;}	
/*.master-left-table{position:absolute;width:56px;background:#fffff0;
    border-radius:3px;
    left:73%;
    padding: 3px;
    top: 100%;
    font-weight:normal !important;
    text-decoration:none !important;
    }
    
.master-left-table:hover{background:#fff;}    
.addprofiles li{position:relative;}*/

 .rateitem #rateItemTable .code-name,.numberVal {width:85%;}
.rateitem #rateItemTable .rateItemDescription {width:95%;}
.profilerightcontent label{margin-bottom:4px;}


</style>
